package file;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @author wang hao
 * @date 2023-04-02 09:27
 *
 *  拷贝文件
 */
public class Demo07 {
    public static void main(String[] args) throws IOException {
        FileOutputStream fo = new FileOutputStream("src/main/java/file/2.jpg",true);
        FileInputStream fi = new FileInputStream("src/main/java/file/1.jpg");

        int len;
        byte[] buffer = new byte[1024];
        while ((len = fi.read(buffer)) != -1){
            fo.write(buffer,0,len);
        }
        fo.close();
    }
}
